#!/bin/bash
#
# chkconfig: 35 90 12
# description: loolwsd server
#

# Get function from functions library
. /etc/init.d/functions

# Start the service loolwsd
start() {
        echo -n $"Starting loolwsd server: "
        su lool -c "/usr/bin/loolwsd --version --o:logging.file[@enable]=true" &
        ### Create the lock file ###
        touch /var/lock/subsys/loolwsd
        success $"loolwsd server startup"
        echo
}

# Stop the service loolwsd
stop() {
        echo -n $"Stopping loolwsd server: "
        killproc loolwsd
        ### Now, delete the lock file ###
        rm -f /var/lock/subsys/loolwsd
        echo
}

### main logic ###
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  status)
        status loolwsd
        ;;
  restart|reload|condrestart)
        stop
        start
        ;;
  *)
        echo $"Usage: $0 {start|stop|restart|reload|status}"
        exit 1
esac

exit 0
